﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;

namespace VideoReflector.Converters
{
    /// <summary>
    /// Multi Value Converter which takes audio and video bit rates as input values and returns
    /// an estimate of the number of MB required to encode one hour of video
    /// </summary>
    public class EstimatedVideoSizeConverter : ConverterWithMarkupExtension, IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!new List<object>(values).Contains(DependencyProperty.UnsetValue)
                && !new List<object>(values).Contains(null)
                && !new List<object>(values).Contains(""))
            {
                return (((int)values[0] + (int)values[1]) * 3600 / (1000 * 8)).ToString();
            }
            return "--";
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
